﻿using MiniExcelLibs.Attributes;
using SqlSugar;
using System.ComponentModel.DataAnnotations;

namespace Zhp.Model.Message.Email
{
    public class EmailTemplateModel
    {
        /// <summary>
        /// 主键
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 模板名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 抄送邮箱地址
        /// </summary>
        public string BccEmailAddresses { get; set; }

        /// <summary>
        /// 主题
        /// </summary>
        public string Subject { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        public string Body { get; set; }

        /// <summary>
        /// 是否激活
        /// </summary>
        public bool IsActive { get; set; }

        /// <summary>
        /// 发送邮箱账户
        /// </summary>
        public long EmailAccountId { get; set; }

        /// <summary>
        /// 发送邮箱账户
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// 动态替换变量的类
        /// </summary>
        public string VariableClass { get; set; }
    }

    /// <summary>
    /// 列表查询参数
    /// </summary>
    public class QueryEmailTemplateParam : PageModel
    {

    }

    /// <summary>
    /// 新增和修改参数
    /// </summary>
    public class EditEmailTemplateParam
    {
        /// <summary>
        /// 主键
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 模板名称
        /// </summary>
        [Required]
        public string Name { get; set; }

        /// <summary>
        /// 抄送邮箱地址
        /// </summary>
        public string BccEmailAddresses { get; set; }

        /// <summary>
        /// 主题
        /// </summary>
        [Required]
        public string Subject { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        [Required]
        public string Body { get; set; }

        /// <summary>
        /// 是否激活
        /// </summary>
        public bool IsActive { get; set; }

        /// <summary>
        /// 邮箱账户标识符
        /// </summary>
        [Required]
        public long EmailAccountId { get; set; }

        /// <summary>
        /// 动态替换变量的类
        /// </summary>
        public string VariableClass { get; set; }
    }

    /// <summary>
    /// 模板变量数据
    /// </summary>
    public class TemplateVariableModel
    {
        public string Text { get; set; }
        public string Value { get; set; }
    }

    /// <summary>
    /// 用来测试发送邮件的测试数据
    /// </summary>
    public class TemplateVariableJson
    {
        public string Json { get; set; }
    }

    /// <summary>
    /// 测试发送邮件参数
    /// </summary>
    public class TestSendEmailParam
    {
        public long Id { get; set; }

        /// <summary>
        /// 测试数据
        /// </summary>
        public string EmailData { get; set; }
        
        /// <summary>
        /// 收件人邮箱
        /// </summary>
        public string ToEmailAddress { get; set; }

        /// <summary>
        /// 收件人名称
        /// </summary>
        public string ToEmailName { get; set; }
    }

    public class EmailTemplateExcel
    {
        [ExcelColumn(Name = "ID")]
        public long Id { get; set; }

        /// <summary>
        /// 模板名称
        /// </summary>
        [ExcelColumn(Name = "模板名称")]
        public string Name { get; set; }

        /// <summary>
        /// 抄送邮箱地址
        /// </summary>
        [ExcelColumn(Name = "抄送邮箱地址")]
        public string BccEmailAddresses { get; set; }

        /// <summary>
        /// 主题
        /// </summary>
        [ExcelColumn(Name = "主题")]
        public string Subject { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        [ExcelColumn(Name = "内容")]
        public string Body { get; set; }

        /// <summary>
        /// 是否激活
        /// </summary>
        [ExcelColumn(Name = "是否激活")]
        public bool IsActive { get; set; }

        /// <summary>
        /// 发送邮箱账户
        /// </summary>
        [ExcelColumn(Name = "发送邮箱账户ID")]
        public long EmailAccountId { get; set; }

        /// <summary>
        /// 动态替换变量的类
        /// </summary>
        [ExcelColumn(Name = "数据源")]
        public string VariableClass { get; set; }
    }
}
